import React from 'react'
import { createBrowserRouter } from 'react-router-dom'

import MainLayout from '../layouts/MainLayout.tsx'
import ManageLayout from '../layouts/ManageLayout.tsx';
import QuestionLayout from '../layouts/QuestionLayout.tsx';
import Home from '../pages/Home.tsx';
import Login from '../pages/Login.tsx';
import Register from '../pages/Register.tsx';
import NotFound from '../pages/NotFound.tsx';
import List2 from '../pages/manage/List2.tsx'
import Star from '../pages/manage/Star.tsx'
import Trash from '../pages/manage/Trash.tsx'
// import QuestionCard from '../components/QuestionCard.tsx';
import Edit from '../pages/question/Edit/index.tsx';
import Stat from '../pages/question/Stat/index.tsx';


const router = createBrowserRouter([
    {
        path:'/',
        element: <MainLayout />,
        children:[
            {path:'/',element:<Home />},
            {path:'/login',element:<Login />},
            {path:'/register',element:<Register />},
            {path:'manage',element:<ManageLayout />,
                children:[
                    {path:'list',element:<List2 />},
                    {path:'star',element:<Star />},
                    {path:'trash',element:<Trash />},
                ]
            },
            
            {path:'*',element:<NotFound />}, // 404兜底
        ]
    },
    {path:'question',element:<QuestionLayout />,children:[
        {path:'edit/:id',element:<Edit />},
        {path:'stat/:id',element:<Stat />},
    ]},
])

export default router


// -------------------------分割线---------------------- 

export const HOME_PATHNAME = '/'
export const LOGIN_PATHNAME = '/login'
export const REGISTER_PATHNAME = '/register'
export const MANAGE_INDEX_PATHNAME = '/manage/list'
